home *** CD-ROM | disk | FTP | other *** search
/ Animation How-To / Animation How-to CD.iso / PLY / CHAPTER4 / IMPACT / IMPACT.PI next >
Text File  |  1994-01-01  |  2KB  |  96 lines

  1. // impact:  A ball slips through a viscous mirror
  2. //          Jeff Bowermaster  1/16/93
  3.  
  4. start_frame 0
  5. end_frame 134
  6. total_frames 135
  7.  
  8. outfile imp
  9.               
  10. // Set up the camera
  11. viewpoint {
  12.    from <5,3,5>
  13.    at <0,-0.12,0>
  14.    up <0,1,0>
  15.    angle 25
  16.    resolution 320,200
  17.    aspect 1.433
  18.    }
  19.  
  20. // Get various surface finishes
  21. include "\ply\colors.inc"
  22.  
  23. define mirror2
  24. texture {
  25.    surface {
  26.       ambient gold, 0.1
  27.       diffuse white, 0.2
  28.       specular 0
  29.       reflection white, 1
  30.       }
  31.    }
  32.  
  33. // Set up background color & lights
  34. background SkyBlue
  35.  
  36. // a coral colored light
  37. light <1,0.5,0>,<0,10,0>
  38.  
  39. define pi 3.14159
  40. define rad pi/180
  41.  
  42. // make the wave front collapse and then expand
  43.  
  44. if (frame <40)
  45.    define wave_radius cos((frame)*4.8*rad) + 1
  46. else
  47.    define wave_radius (frame-40)/20
  48.  
  49. define phase_in -(0.75+0.65*(frame-20)/30)
  50.  
  51. //start with a flat surface, indent and rebound, then decay
  52.  
  53. if (frame <20)
  54.    define height 0
  55. else if (frame <50)
  56.    define height phase_in*sin(9 * (frame - 20) * rad)
  57. else
  58.    define height 5/exp(frame/40)
  59.  
  60. // Heightfield is a radially symmetrical expanding gaussian
  61.  
  62. define width  0.3
  63. define r (x^2+z^2)^0.5
  64.  
  65. define HFn height / EXP(((r - wave_radius) / width) ^ 2)
  66. define detail 100
  67.  
  68. // Define the wave surface
  69. object {
  70.      smooth_height_fn detail, detail, -10, 10, -10, 10, HFn
  71.      mirror2
  72.      }
  73.  
  74. // Drop an expanding ball on it
  75.  
  76. define ball (23-frame)/7.5
  77. define grow 0.25+0.25*frame/20
  78.  
  79. object {
  80.    sphere <0,ball,0>,grow
  81.    shiny_coral
  82.    }
  83.  
  84. //give the surface something hidden to reflect
  85.  
  86. object {
  87.   disc <0, 20, 0>, <0, 1, 0>, 20
  88.     texture {
  89.        checker matte_white, matte_black
  90.        translate <0, -0.1, 0>
  91.        scale <2, 1, 2>
  92.        }
  93.    }
  94.  
  95.  
  96.